package test;

import javax.swing.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-03-14
 * Time: 22:47
 */
public class MyJFrame3 extends JFrame implements KeyListener {

    public MyJFrame3() {
        //设置界面宽高
        this.setSize(603,608);

        //设置界面标题
        this.setTitle("拼图游戏单机版 v1.0");

        //设置界面置顶
        this.setAlwaysOnTop(true);

        //设置界面居中
        this.setLocationRelativeTo(null);

        //关闭模式
        this.setDefaultCloseOperation(3);

        //取消默认的居中方式

        this.setLayout(null);


        this.addKeyListener(this);

        this.setVisible(true);
    }

    @Override
    public void keyTyped(KeyEvent e) {

    }

    @Override
    public void keyPressed(KeyEvent e) {
        System.out.println("按下不松");
    }

    @Override
    public void keyReleased(KeyEvent e) {
        System.out.println("松开按键");
    }
}
